import { createRouter, createWebHashHistory } from "vue-router";
import Login from "../views/login";
import Layout from "@/views/layout/index";

const routes = [
  {
    path: "/",
    redirect: "/console",
    meta: {
      hidden: true,
      title: "主页"
    }
  },
  {
    path: "/login",
    name: "login",
    component: Login,
    meta: {
      hidden: true,
      title: "登录"
    }
  },
  {
    path: "/console",
    name: "Console",
    redirect: "index",
    component: Layout,
    meta: {
      hidden: false,
      title: "控制台",
      icon: "console"
    },
    children: [
      {
        path: "/index",
        name: "Index",
        component: () => import("../views/Console/index"),
        meta: { title: "首页" }
      }
    ]
  },
  {
    path: "/basicInfo",
    name: "BasicInfo",
    component: Layout,
    meta: {
      hidden: false,
      title: "基础信息",
      icon: "basicInfo"
    },
    children: [
      {
        path: "/accInfo",
        name: "AccInfo",
        component: () => import("../views/BasicInfo/AccInfo"),
        meta: { title: "账户信息" }
      },
      {
        path: "/fundBasic",
        name: "FundBasic",
        component: () => import("../views/BasicInfo/FundBasic"),
        meta: { title: "基金仓库" }
      }
    ]
  },
  {
    path: "/invest",
    name: "Invest",
    component: Layout,
    meta: {
      hidden: false,
      title: "理财投资",
      icon: "fund"
    },
    children: [
      {
        path: "/fundHold",
        name: "FundHold",
        component: () => import("../views/Fund/index"),
        meta: {
          title: "基金持仓"
        }
      },
      {
        path: "/shareSelect",
        name: "ShareSelect",
        component: () => import("../views/Share/index"),
        meta: {
          title: "股票选择"
        }
      }
    ]
  },
  {
    path: "/report",
    name: "Report",
    component: Layout,
    meta: {
      hidden: false,
      title: "投资报表",
      icon: "fund"
    },
    children: [
      {
        path: "/fundReport",
        name: "fundReport",
        component: () => import("../views/report/index"),
        meta: {
          title: "风险占比"
        }
      }
    ]
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
